﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="../src/utilFn.js"></script>
    <script src="../utilPackage/jquery-1.11.3.min.js"></script>
    <link href="../utilPackage/utilFn.css" rel="stylesheet" />

</head>
<body>
    <div class="subPage">
        <div class="subPage-title">
            对象类型数组常用处理方法（与sql中table对应）
        </div>
        <div class="subPage-sub-title"></div>
        <div id="push" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">Array.<strong>push</strong> </span> <span class="title-type">Function(Value)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//**---------数组的后面接上一个值（数字，对象，数组），返回数组的长度------------*/</span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例子1： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> canshu1 </span><span class="pun">=</span><span class="pln"> </span><span class="lit">9</span><span class="pun">;</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">push</span><span class="pun">(</span><span class="pln">canshu1</span><span class="pun">);</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//打印结果 </span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry1就是[3,2,6,4,8,9]; </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是6;</span></code></li><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例子2： </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> canshu1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">};</span><span class="pln">       </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">push</span><span class="pun">(</span><span class="pln">canshu1</span><span class="pun">);</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//打印结果 </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry1就是'[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"}]'; </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'3';  </span></code></li><li class="L8"><code class="lang-javascript"></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例子3： </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> canshu1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">}];</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">push</span><span class="pun">(</span><span class="pln">canshu1</span><span class="pun">);</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//打印结果 </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry1就是[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},[{"id":"3","name":"cc","state":"1"}]]; </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是3;  </span></code></li><li class="L6"><code class="lang-javascript"></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例子4： </span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> canshu1 </span><span class="pun">=</span><span class="pln"> </span><span class="lit">3</span><span class="pun">;</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">push</span><span class="pun">(</span><span class="pln">canshu1</span><span class="pun">);</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//打印结果 </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln">  </span><span class="com">//objAry1就是[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},3]; </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是3;</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    Array.push(Value)<br />
                    //数组的后面接上一个值（数字，对象，数组），返回数组的长度<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="pushInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"}]</textarea>
                </div>
                <div>
                    请输入对象字符串<b>[Value]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="pushInput1" class="InputTextarea">{"id":"3","name":"cc","state":"1"}</textarea>
                </div>
                <div> <input id="pushButton" type="button" value="执行 Array.push(Value)" /> </div>
                <div>
                    显示结果 JSON.stringify(Object)(这是原来的数组)<span class="font-red">（原数组会改变）</span>
                </div>
                <div>
                    <textarea id="pushOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果 (返回的结果)
                </div>
                <div>
                    <textarea id="pushOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#pushButton").click(function () {
                        var objAry1 = JSON.parse($('#pushInput').val());
                        var objAry2 = JSON.parse($('#pushInput1').val());
                        var objAry3 = objAry1.push(objAry2);
                        $('#pushOutput').val(JSON.stringify(objAry1));
                        $('#pushOutput1').val(JSON.stringify(objAry3));
                    });
                </script>
            </div>
        </div>

        <div id="pop" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">Array.<strong>pop</strong> </span> <span class="title-type">Function()</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">              </span><span class="com">//* 去掉数组中最后一条数据,返回去掉那条数据*/</span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="lit">2</span><span class="pun">,</span><span class="lit">6</span><span class="pun">,</span><span class="lit">4</span><span class="pun">,</span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">pop</span><span class="pun">();</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln"> </span><span class="com">// objAry1就是'[3,2,6,4]'; </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'8';        </span></code></li><li class="L8"><code class="lang-javascript"></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2： </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">pop</span><span class="pun">();</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln"> </span><span class="com">// objAry1就是'[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"}]'; </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">// objAry2就是'{"id":"3","name":"cc","state":"1"}';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    Array.pop()<br />
                    //与push相反，去掉数组的最后一条，返回的是最后一条数据<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="popInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"}]</textarea>
                </div>
                <div> <input id="popButton" type="button" value="执行 Array.pop()" /> </div>
                <div>
                    显示结果 JSON.stringify(Object) (<b>原数组</b>)<span class="font-red">（原数组会改变）</span>
                </div>
                <div>
                    <textarea id="popOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果 JSON.stringify(Object)(<b>返回的数组/对象</b>)
                </div>
                <div>
                    <textarea id="popOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#popButton").click(function () {
                        var objAry1 = JSON.parse($('#popInput').val());
                        var objAry2 = objAry1.pop();
                        $('#popOutput').val(JSON.stringify(objAry1));
                        $('#popOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="shift" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">Array.<strong>shift</strong> </span> <span class="title-type">Function()</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">        </span><span class="com">//*------跟pop有点相似，去掉数组中第一条数据，返回去掉的数据---------*/ </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">shift</span><span class="pun">();</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln">  </span><span class="com">//objAry1就是'[2,6,4,8]'; </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'3';       </span></code></li><li class="L8"><code class="lang-javascript"></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2： </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">shift</span><span class="pun">();</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry1就是'[{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"}]'; </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'{"id":"1","name":"aa","state":"1"}';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    Array.shift()<br />
                    //跟pop有点相似，去掉数组中第一条数据，返回去掉的数据<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="shiftInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"}]</textarea>
                </div>
                <div> <input id="shiftButton" type="button" value="执行 Array.shift()" /> </div>
                <div>
                    显示结果 JSON.stringify(Object) (<b>原数组</b>)<span class="font-red">（原数组会改变）</span>
                </div>
                <div>
                    <textarea id="shiftOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果 JSON.stringify(Object)(<b>返回的数组/对象</b>)
                </div>
                <div>
                    <textarea id="shiftOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#shiftButton").click(function () {
                        var objAry1 = JSON.parse($('#shiftInput').val());
                        var objAry2 = objAry1.shift();
                        $('#shiftOutput').val(JSON.stringify(objAry1));
                        $('#shiftOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="unshift" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">Array.<strong>unshift</strong> </span> <span class="title-type">Function(Value)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">         </span><span class="com">//*------跟push有点相似，在数组前面接一条数据，返回数组的长度--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> canshu1 </span><span class="pun">=</span><span class="pln"> </span><span class="lit">9</span><span class="pun">;</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">unshift</span><span class="pun">(</span><span class="pln">canshu1</span><span class="pun">);</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry1就是'[9,3,2,6,4,8]'; </span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="com">//objAry2就是'6';        </span></code></li><li class="L9"><code class="lang-javascript"></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2： </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> canshu1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">};</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">unshift</span><span class="pun">(</span><span class="pln">canshu1</span><span class="pun">);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry1就是'[{"id":"3","name":"cc","state":"1"},{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"}]'; </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'3';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    Array.unshift(Value)<br />
                    //跟push有点相似，在数据前面接一条数据，返回数组的长度<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="unshiftInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"}]</textarea>
                </div>
                <div>
                    请输入对象字符串<b>[Value]</b>（对象中用JSON.parse(String)
                </div>
                <div>
                    <textarea id="unshiftInput1" class="InputTextarea">{"id":"3","name":"cc","state":"1"}</textarea>
                </div>
                <div> <input id="unshiftButton" type="button" value="执行 Array.unshift(Value)" /> </div>
                <div>
                    显示结果 JSON.stringify(Object)(<b>原数组</b>)<span class="font-red">（原数组会改变）</span>
                </div>
                <div>
                    <textarea id="unshiftOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果 (返回的结果)
                </div>
                <div>
                    <textarea id="unshiftOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#unshiftButton").click(function () {
                        var objAry1 = JSON.parse($('#unshiftInput').val());
                        var objAry2 = JSON.parse($('#unshiftInput1').val());
                        var objAry3 = objAry1.unshift(objAry2);
                        $('#unshiftOutput').val(JSON.stringify(objAry1));
                        $('#unshiftOutput1').val(JSON.stringify(objAry3));
                    });
                </script>
            </div>
        </div>

        <div id="splice" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">Array.<strong>splice</strong> </span> <span class="title-type">Function(Number,Number,Object,Object...)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">         </span><span class="com">//*-------数组在索引的位置，先去掉几条数据，在添加几条数据-------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">splice</span><span class="pun">(</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="lit">9</span><span class="pun">);</span><span class="com">//在索引位置1前面添加一个9 </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//objAry1就是'[3,9,2,6,4,8]'; </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'[]';</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2： </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">splice</span><span class="pun">(</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">9</span><span class="pun">);</span><span class="com">//在索引位置1，先删除一个数据，再添加一个9  </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//objAry1就是'[3,9,6,4,8]'; </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'[2]';</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如3： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">splice</span><span class="pun">(</span><span class="lit">1</span><span class="pun">);</span><span class="com">//在索引位置1，全部切掉 </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//objAry1就是'[3，]'; </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'[2,6, 4, 8]'; </span></code></li><li class="L8"><code class="lang-javascript"></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如4： </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">splice</span><span class="pun">(</span><span class="lit">1</span><span class="pun">,</span><span class="lit">2</span><span class="pun">,</span><span class="lit">9</span><span class="pun">,</span><span class="lit">9</span><span class="pun">);</span><span class="com">//在索引位置1，先删除2条，在添加9 </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//objAry1就是'[3,9,9,4,8]'; </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'[2,6]'; </span></code></li><li class="L4"><code class="lang-javascript"></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如4： </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                     </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                     </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">splice</span><span class="pun">(</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"5"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"ee"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//objAry1就是'[{"id":"1","name":"aa","state":"1"},{"id":"4","name":"dd","state":"0"},{"id":"5","name":"ee","state":"1"},{"id":"3","name":"cc","state":"1"}]'; </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln">  </span><span class="com">//objAry2就是'[{"id":"2","name":"bb","state":"0"}]';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    Array.splice(Number1,Number2,Value1,Value2...)<br />
                    //在数组第Number1条后面，先删除Number2条，再添加Object（可以是对象和数组）返回被删除的项<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="spliceInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"}]</textarea>
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数1<b>[Number1]</b>：<input id="spliceCanshu1" type="text" value="1" /><br />
                    参数2<b>[Number2]</b>：<input id="spliceCanshu2" type="text" value="1" />
                </div>

                <div>
                    请输入对象字符串<b>[Value1,Value2]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="spliceInput1" class="InputTextarea">{"id":"4","name":"dd","state":"0"}</textarea>
                </div>
                <div>
                    <textarea id="spliceInput2" class="InputTextarea">{"id":"5","name":"ee","state":"1"}</textarea>
                </div>
                <div> <input id="spliceButton" type="button" value="执行 Array.splice(Number1,Number2,Value1,Value2...)" /> </div>
                <div>
                    显示结果 JSON.stringify(Object)(<b>原数组</b>)<span class="font-red">（原数组会改变）</span>
                </div>
                <div>
                    <textarea id="spliceOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果 JSON.stringify(Object)(返回的结果)
                </div>
                <div>
                    <textarea id="spliceOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#spliceButton").click(function () {
                        var objAry1 = JSON.parse($('#spliceInput').val());
                        var CanShu1 = parseInt($('#spliceCanshu1').val());
                        var CanShu2 = parseInt($('#spliceCanshu2').val());
                        var obj1 = JSON.parse($('#spliceInput1').val());

                        var objAry2 = {};
                        if ($('#spliceInput2').val() == '') {
                            objAry2 = objAry1.splice(CanShu1, CanShu2, obj1);
                        } else {
                            var obj2 = JSON.parse($('#spliceInput2').val());
                            objAry2 = objAry1.splice(CanShu1, CanShu2, obj1, obj2);
                        }


                        $('#spliceOutput').val(JSON.stringify(objAry1));
                        $('#spliceOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="merge" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>merge</strong> </span> <span class="title-type">Function(Array,[Array/Object],[Array/Object],[Array/Object],......)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">          </span><span class="com">//*------数组拼接 返回拼接好的新数组--------*/ </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> canshu1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="lit">23</span><span class="pun">];</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">merge</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> canshu1</span><span class="pun">);</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//objAry1就是'[3,2,6,4,8,3,2,0,23]'; </span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'9';         </span></code></li><li class="L9"><code class="lang-javascript"></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2： </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                             </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> canshu1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">};</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">merge</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> canshu1</span><span class="pun">);</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry1就是'[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"}]'; </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'3';        </span></code></li><li class="L7"><code class="lang-javascript"></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如3： </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                             </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> canshu1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                       </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> merge</span><span class="pun">.</span><span class="pln">merge</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> canshu1</span><span class="pun">);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry1就是'[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]'; </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'4';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.merge(Array,[Array/Object],[Array/Object],[Array/Object],......)<br />
                    //数组拼接 返回拼接好的新数组<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="mergeInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"}]</textarea>
                </div>
                <div>
                    请输入对象字符串<b>[Value]</b>（对象中用JSON.parse(String)
                </div>
                <div>
                    <textarea id="mergeInput1" class="InputTextarea">{"id":"3","name":"cc","state":"1"}</textarea>
                </div>
                <div> <input id="mergeButton" type="button" value="执行  g.merge(Array,Value)" /> </div>
                <div>
                    显示结果 JSON.stringify(Object)(<b>原数组</b>)<span class="font-red">（原数组会改变）</span>
                </div>
                <div>
                    <textarea id="mergeOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果 (返回的结果)
                </div>
                <div>
                    <textarea id="mergeOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#mergeButton").click(function () {
                        var objAry1 = JSON.parse($('#mergeInput').val());
                        var objAry2 = JSON.parse($('#mergeInput1').val());
                        var objAry3 = g.merge(objAry1, objAry2);
                        $('#mergeOutput').val(JSON.stringify(objAry1));
                        $('#mergeOutput1').val(JSON.stringify(objAry3));
                    });
                </script>
            </div>
        </div>

        <div id="index" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>index</strong> </span> <span class="title-type">Function(Array,String/Function,Value)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">           </span><span class="com">//*------求出在数组中的索引位置--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Num1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">index</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">);</span><span class="com">//求出6的索引位置       </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Num1</span><span class="pun">);</span><span class="com">//Num1就是'2'</span></code></li><li class="L7"><code class="lang-javascript"></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2： </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span><span class="pln"> </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Num1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">index</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//求出表中id=2的行的索引位置 </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Num1</span><span class="pun">);</span><span class="com">//Num1就是'1'</span></code></li><li class="L5"><code class="lang-javascript"></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如3： </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Num1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">index</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">id </span><span class="pun">==</span><span class="pln"> </span><span class="lit">2</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="com">//求出表中id=2的行的索引位置 </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                               </span><span class="pun">}</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                          </span><span class="pun">});</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Num1</span><span class="pun">);</span><span class="com">//Num1就是'1'</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.index(Array,Value/Function,Value)<br />
                    //求出在数组中的索引位置<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="indexInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[Value/Function]</b>
                </div>
                <div>
                    <textarea id="indexCanshu1" class="InputTextarea">
                    function (it) {
                        if (it.id == 2) { 
                        return  true;
                               }
                          }
                    </textarea>
                </div>
                <div style="padding:10px; line-height:32px;">
                    参数2<b>[Value]</b>：<input id="indexCanshu2" type="text" value="" />
                </div>
                <div> <input id="indexButton" type="button" value="执行 g.index(Array,Value/Function,Value)" /> </div>

                <div>
                    显示结果
                </div>
                <div>
                    <textarea id="indexOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#indexButton").click(function () {
                        var objAry1 = JSON.parse($('#indexInput').val());
                        var canshu1 = $('#indexCanshu1').val();
                        var canshu2 = $('#indexCanshu2').val() || null;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        var Num1 = g.index(objAry1, canshu1, canshu2);
                        $('#indexOutput').val(Num1);
                    });
                </script>
            </div>
        </div>

        <div id="max" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>max</strong> </span> <span class="title-type">Function(Array,String)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">            </span><span class="com">//*------求出数组中最大的数值--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Num1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">max</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Num1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//Num1就是'8'; </span></code></li><li class="L7"><code class="lang-javascript"></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2： </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Num1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">max</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Num1</span><span class="pun">);</span><span class="pln">  </span><span class="com">//Num1就是'4';//字段id中最大就是4</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.max(Array,String)<br />
                    //求出数组中最大的数值<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="maxInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px; line-height:32px;">
                    参数1<b>[String]</b>：<input id="maxCanshu1" type="text" value="id" />
                </div>
                <div> <input id="maxButton" type="button" value="执行  g.max(Array,String)" /> </div>

                <div>
                    显示结果
                </div>
                <div>
                    <textarea id="maxOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#maxButton").click(function () {
                        var objAry1 = JSON.parse($('#maxInput').val());
                        var canshu1 = $('#maxCanshu1').val();
                        if (canshu1 == '') {
                            canshu1 = null;
                        }
                        var Num1  = g.max(objAry1, canshu1);
                        $('#maxOutput').val(Num1 );
                    });
                </script>
            </div>
        </div>

        <div id="min" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>min</strong> </span> <span class="title-type">Function(Array,String)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//*------求出数组中最小的数值--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Num1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">min</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Num1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//Num1就是'2';</span></code></li><li class="L7"><code class="lang-javascript"></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2： </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Num1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">min</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Num1</span><span class="pun">);</span><span class="pln">  </span><span class="com">//Num1就是'1';//属性id中最小就是1</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.min(Array,String)<br />
                    //求出数组中最小的数值<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="minInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数1<b>[String]</b>：<input id="minCanshu1" type="text" value="id" />
                </div>
                <div> <input id="minButton" type="button" value="执行 g.min(Array,String)" /> </div>

                <div>
                    显示结果
                </div>
                <div>
                    <textarea id="minOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#minButton").click(function () {
                        var objAry1 = JSON.parse($('#minInput').val());
                        var canshu1 = $('#minCanshu1').val();
                        if (canshu1 == '') {
                            canshu1 = null;
                        }
                        var Num1 = g.min(objAry1, canshu1);
                        $('#minOutput').val(Num1);
                    });
                </script>
            </div>
        </div>

        <div id="sum" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>sum</strong> </span> <span class="title-type">Function(Array,String/Array)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                   </span><span class="com">//*------求出数组中数值的合计--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">sum</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Obj1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//Obj1就是'23'; </span></code></li><li class="L7"><code class="lang-javascript"></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2： </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">sum</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Obj1</span><span class="pun">);</span><span class="com">//Obj1就是'{"id":10}';//字段id合计就是10</span></code></li><li class="L5"><code class="lang-javascript"></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如3： </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">sum</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id,state'</span><span class="pun">);</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">sum</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[</span><span class="str">"id"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">]);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Obj1</span><span class="pun">);</span><span class="com">//  Obj1就是'{"id":10,"state":2}'; </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//字段id合计就是10,state合计是2</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.sum(Array,String/Array)<br />
                    //获取数组中数值的合计<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="sumInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px;line-height:32px;">参数1<b>[String/Array]</b>：<input id="sumCanshu1" type="text" value="id" /></div>
                <div> <input id="sumButton" type="button" value="执行 g.sum(Array,String/Array)" /> </div>

                <div>
                    显示结果JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="sumOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#sumButton").click(function () {
                        var objAry1 = JSON.parse($('#sumInput').val());
                        var canshu1 = $('#sumCanshu1').val();
                        if (canshu1 == '') {
                            canshu1 = null;
                        } else if (canshu1.indexOf('[') > -1) {
                            canshu1 = JSON.parse(canshu1);
                        }
                        var Obj1 = g.sum(objAry1, canshu1);
                        $('#sumOutput').val(JSON.stringify(Obj1));
                    });
                </script>
            </div>
        </div>

        <div id="avg" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>avg</strong> </span> <span class="title-type">Function(Array,String/Array)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                   </span><span class="com">//*------求出数组中数值的平均值--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">,</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">8</span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">avg</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Obj1</span><span class="pun">);</span><span class="com">//Obj1就是'4.6'; </span></code></li><li class="L7"><code class="lang-javascript"></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2： </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">avg</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Obj1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//Obj1就是'{"id":2.5}';//字段id平均值就是2.5 </span></code></li><li class="L5"><code class="lang-javascript"></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如3： </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">avg</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id,state'</span><span class="pun">);</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">avg</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[</span><span class="str">"id"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">]);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Obj1</span><span class="pun">);</span><span class="com">//Obj1就是'{"id":2.5,"state":0.5}'; </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//字段id平均值就是2.5,state平均值是0.5</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.avg(Array,String/Array)<br />
                    //求出数组中数值的平均值<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="avgInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数1<b>[String/Array]</b>：<input id="avgCanshu1" type="text" value="id" />
                </div>
                <div> <input id="avgButton" type="button" value="执行  g.avg(Array,String/Array)" /> </div>

                <div>
                    显示结果JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="avgOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#avgButton").click(function () {
                        var objAry1 = JSON.parse($('#avgInput').val());
                        var canshu1 = $('#avgCanshu1').val();
                        if (canshu1 == '') {
                            canshu1 = null;
                        } else if (canshu1.indexOf('[') > -1) {
                            canshu1 = JSON.parse(canshu1);
                        }
                        var Obj1 = g.avg(objAry1, canshu1);
                        $('#avgOutput').val(JSON.stringify(Obj1));
                    });
                </script>
            </div>
        </div>

        <div id="group" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>group</strong> </span> <span class="title-type">Function(Array,String/Array,Function)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"><span class="com">//求组合相关操作</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">202</span><span class="pun">,</span><span class="str">"rmb"</span><span class="pun">:</span><span class="lit">365</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">100</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-07"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">300</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-08"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">400</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-09"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">323</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">56</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">23</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-07"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">12</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-08"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-09"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">9</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"食物"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1000</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"食物"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1500</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">}</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">        </span><span class="pun">];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">group</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[</span><span class="str">'name'</span><span class="pun">],</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">,</span><span class="pln"> d</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="com">//根据name求组</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">            it</span><span class="pun">.</span><span class="pln">count </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">sum</span><span class="pun">(</span><span class="pln">d</span><span class="pun">,</span><span class="pln"> </span><span class="str">'count'</span><span class="pun">)[</span><span class="str">'count'</span><span class="pun">];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">            it</span><span class="pun">.</span><span class="pln">avgCount </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">avg</span><span class="pun">(</span><span class="pln">d</span><span class="pun">,</span><span class="pln"> </span><span class="str">'count'</span><span class="pun">)[</span><span class="str">'count'</span><span class="pun">];</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">            it</span><span class="pun">.</span><span class="pln">shuliang </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">count</span><span class="pun">(</span><span class="pln">d</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">        </span><span class="pun">});</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">         </span><span class="com">//objAry2为 如下</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">        objAry2 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1325</span><span class="pun">,</span><span class="pln"> </span><span class="str">"avgCount"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">265</span><span class="pun">,</span><span class="pln"> </span><span class="str">"shuliang"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">5</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">103</span><span class="pun">,</span><span class="pln"> </span><span class="str">"avgCount"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">20.6</span><span class="pun">,</span><span class="pln"> </span><span class="str">"shuliang"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">5</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"食物"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">2500</span><span class="pun">,</span><span class="pln"> </span><span class="str">"avgCount"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1250</span><span class="pun">,</span><span class="pln"> </span><span class="str">"shuliang"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">2</span><span class="pln"> </span><span class="pun">}</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">        </span><span class="pun">];</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.group(Array,String/Array,Function)<br />
                    //String/Array表示按哪些字段分组<br />
                    //Function 表示相关操作，比如求和，求平均，求最大值或者最小值等等<br />
                    <br />
                    //求组相关的操作 看例子<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="groupInput" class="InputTextarea">[
            { "StatDate": "2019-02-05", "name": "宝石", "count": 202,"rmb":365 },
            { "StatDate": "2019-02-06", "name": "宝石", "count": 100, "rmb": 365},
            { "StatDate": "2019-02-07", "name": "宝石", "count": 300, "rmb": 365},
            { "StatDate": "2019-02-08", "name": "宝石", "count": 400, "rmb": 365},
            { "StatDate": "2019-02-09", "name": "宝石", "count": 323, "rmb": 365},
            { "StatDate": "2019-02-05", "name": "器灵", "count": 56, "rmb": 365 },
            { "StatDate": "2019-02-06", "name": "器灵", "count": 23, "rmb": 365},
            { "StatDate": "2019-02-07", "name": "器灵", "count": 12, "rmb": 365},
            { "StatDate": "2019-02-08", "name": "器灵", "count": 3, "rmb": 365},
            { "StatDate": "2019-02-09", "name": "器灵", "count": 9, "rmb": 365},
            { "StatDate": "2019-02-05", "name": "食物", "count": 1000, "rmb": 365 },
            { "StatDate": "2019-02-06", "name": "食物", "count": 1500, "rmb": 365}
        ]</textarea>
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数1<b>[String/Array]</b>：<input id="groupCanshu1" type="text" value="name" />
                </div>
                <div>
                    参数2<b>[Function]</b>
                </div>
                <div>
                    <textarea id="groupCanshu2" class="InputTextarea">
                    function (it, d) {
                        it.count = g.sum(d, 'count')['count'];
                        it.avgCount = g.avg(d, 'count')['count'];
                        it.shuliang = g.count(d, function () { return true; });
                    }
                    </textarea>
                </div>
                <div> <input id="groupButton" type="button" value="执行 g.group(Array,String/Function,Object)" /> </div>
                <div>
                    显示结果
                </div>
                <div>
                    <textarea id="groupOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#groupButton").click(function () {
                        var objAry1 = JSON.parse($('#groupInput').val());
                        var canshu1 = $('#groupCanshu1').val();
                        if (canshu1 == '') {
                            canshu1 = null;
                        } else if (canshu1.indexOf('[') > -1) {
                            canshu1 = JSON.parse(canshu1);
                        }


                        var canshu2 = $('#groupCanshu2').val();
                        if (g.like(canshu2, '%function%')) {
                            eval('canshu2 = ' + canshu2);
                        }
                        var objAry2 = g.group(objAry1, canshu1, canshu2);

                        $('#groupOutput').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="pivot" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>pivot</strong> </span> <span class="title-type">Function(Array,String/Array,String,String,String/Array)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">      </span><span class="com">//将数据中行转为列</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">202</span><span class="pun">,</span><span class="str">"rmb"</span><span class="pun">:</span><span class="lit">365</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">100</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-07"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">300</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-08"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">400</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-09"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">323</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">56</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">23</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-07"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">12</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-08"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-09"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">9</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">},</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"食物"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1000</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"食物"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1500</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rmb"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">365</span><span class="pun">}</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">        </span><span class="pun">];</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">pivot</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">);</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">        </span><span class="com">//将StatDate中的值转为列，count里面的值就是里面的值</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">        </span><span class="com">//name表示要保留的列，null参数表示里面对"StatDate"的值限制</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">         </span><span class="com">//objAry2为 如下</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">        objAry2 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">202</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">100</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-07"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">300</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-08"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">400</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-09"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">323</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">56</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">23</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-07"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">12</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-08"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-09"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">9</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"食物"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1000</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1500</span><span class="pln"> </span><span class="pun">}</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">        </span><span class="pun">];</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.pivot(Array,String/Array1,String1,String2,String/Array2) //将数组行转列<br />
                    //String/Array1表示哪些字段保留不需要行转列<br />
                    //String1表示这里的内容转为列名<br />
                    //String2表示这里的内容转为列名的值<br />
                    //String/Array2表示列名的范围（默认为null，不限制）<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="pivotInput" class="InputTextarea">[
            { "StatDate": "2019-02-05", "name": "宝石", "count": 202,"rmb":365 },
            { "StatDate": "2019-02-06", "name": "宝石", "count": 100, "rmb": 365},
            { "StatDate": "2019-02-07", "name": "宝石", "count": 300, "rmb": 365},
            { "StatDate": "2019-02-08", "name": "宝石", "count": 400, "rmb": 365},
            { "StatDate": "2019-02-09", "name": "宝石", "count": 323, "rmb": 365},
            { "StatDate": "2019-02-05", "name": "器灵", "count": 56, "rmb": 365 },
            { "StatDate": "2019-02-06", "name": "器灵", "count": 23, "rmb": 365},
            { "StatDate": "2019-02-07", "name": "器灵", "count": 12, "rmb": 365},
            { "StatDate": "2019-02-08", "name": "器灵", "count": 3, "rmb": 365},
            { "StatDate": "2019-02-09", "name": "器灵", "count": 9, "rmb": 365},
            { "StatDate": "2019-02-05", "name": "食物", "count": 1000, "rmb": 365 },
            { "StatDate": "2019-02-06", "name": "食物", "count": 1500, "rmb": 365}
            ]</textarea>
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数1<b>[String/Array]</b>：<input id="pivotCanshu1" type="text" value="name" />
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数2<b>[String]</b>：<input id="pivotCanshu2" type="text" value="StatDate" />
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数3<b>[String]</b>：<input id="pivotCanshu3" type="text" value="count" />
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数4<b>[String/Array]</b>：<input id="pivotCanshu4" type="text" value="" />
                </div>

                <div> <input id="pivotButton" type="button" value="执行 g.pivot(Array,String/Function,Object)" /> </div>
                <div>
                    显示结果
                </div>
                <div>
                    <textarea id="pivotOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#pivotButton").click(function () {
                        var objAry1 = JSON.parse($('#pivotInput').val());
                        var canshu1 = g.trim($('#pivotCanshu1').val());
                        if (canshu1 == '') {
                            canshu1 = null;
                        } else if (canshu1.indexOf('[') > -1) {
                            canshu1 = JSON.parse(canshu1);
                        }
                        var canshu2 = $('#pivotCanshu2').val();
                        var canshu3 = $('#pivotCanshu3').val();
                        var canshu4 = g.trim($('#pivotCanshu4').val());
                        if (canshu4 == '') {
                            canshu4 = null;
                        } else if (canshu4.indexOf('[') > -1) {
                            canshu4 = JSON.parse(canshu4);
                        }
                        console.log(canshu4);
                        var objAry2 = g.pivot(objAry1, canshu1, canshu2, canshu3, canshu4);
                        $('#pivotOutput').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="unpivot" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>unpivot</strong> </span> <span class="title-type">Function(Array,String/Array,String,String,String/Array)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">     </span><span class="com">// 这个函数为列转行</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">202</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">100</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-07"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">300</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-08"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">400</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-09"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">323</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">56</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">23</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-07"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">12</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-08"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">3</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-09"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">9</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"食物"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1000</span><span class="pun">,</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1500</span><span class="pln"> </span><span class="pun">}</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">        </span><span class="pun">];</span></code></li><li class="L7"><code class="lang-javascript"></code></li><li class="L8"><code class="lang-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">unpivot</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">,</span><span class="kwd">null</span><span class="pun">);</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">        </span><span class="com">//name表示要保留的字段</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">         </span><span class="com">//将列名转完存在StatDate字段里面，count表里列里面的值放在count里面</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">        </span><span class="com">//null参数表示里面对"StatDate"的值限制</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">        objAry2 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">202</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">100</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-07"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">300</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-08"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">400</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"宝石"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-09"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">323</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">56</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">23</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-07"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">12</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-08"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">3</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"器灵"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-09"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">9</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"食物"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-05"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1000</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"食物"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"StatDate"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2019-02-06"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"count"</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1500</span><span class="pln"> </span><span class="pun">}</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">        </span><span class="pun">]</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.unpivot(Array,String/Array1,String1,String2,String/Array2) //将数组列转行<br />
                    //String/Array1表示哪些字段保留不需要列转行<br />
                    //String1表示列名转完放在该字段里<br />
                    //String2表示列里面的值放在这字段里面<br />
                    //String/Array2表示列名的范围（默认为null，不限制）<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="unpivotInput" class="InputTextarea">[
            { "name": "宝石", "2019-02-05": 202, "2019-02-06": 100, "2019-02-07": 300, "2019-02-08": 400, "2019-02-09": 323 },
            { "name": "器灵", "2019-02-05": 56, "2019-02-06": 23, "2019-02-07": 12, "2019-02-08": 3, "2019-02-09": 9 },
            { "name": "食物", "2019-02-05": 1000, "2019-02-06": 1500 }
        ]</textarea>
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数1<b>[String/Array]</b>：<input id="unpivotCanshu1" type="text" value="name" />
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数2<b>[String]</b>：<input id="unpivotCanshu2" type="text" value="StatDate" />
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数3<b>[String]</b>：<input id="unpivotCanshu3" type="text" value="count" />
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数4<b>[String/Array]</b>：<input id="unpivotCanshu4" type="text" value="" />
                </div>

                <div> <input id="unpivotButton" type="button" value="执行 g.unpivot(Array,String/Function,Object)" /> </div>
                <div>
                    显示结果
                </div>
                <div>
                    <textarea id="unpivotOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#unpivotButton").click(function () {
                        var objAry1 = JSON.parse($('#unpivotInput').val());
                        var canshu1 = g.trim($('#unpivotCanshu1').val());
                        if (canshu1 == '') {
                            canshu1 = null;
                        } else if (canshu1.indexOf('[') > -1) {
                            canshu1 = JSON.parse(canshu1);
                        }
                        var canshu2 = $('#unpivotCanshu2').val();
                        var canshu3 = $('#unpivotCanshu3').val();
                        var canshu4 = g.trim($('#unpivotCanshu4').val());
                        if (canshu4 == '') {
                            canshu4 = null;
                        } else if (canshu4.indexOf('[') > -1) {
                            canshu4 = JSON.parse(canshu4);
                        }
                        console.log(canshu4);
                        var objAry2 = g.unpivot(objAry1, canshu1, canshu2, canshu3, canshu4);
                        $('#unpivotOutput').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>



        <div id="count" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>count</strong> </span> <span class="title-type">Function(Array,String/Function,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                   </span><span class="com">//*------求出数组中 个数--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Num1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">count</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==1'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Num1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">count</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==@state'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Num1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">count</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="com">//效率最好 </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">state </span><span class="pun">==</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                          </span><span class="pun">});</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Num1</span><span class="pun">);</span><span class="com">//Num1都是'2'; </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 求出state=1时，行的个数，都是最后一个效率最好</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.count(Array,String/Function,Object)//Object是输入的参数对象<br />
                    //求表数组中个数<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="countInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="countCanshu1" class="InputTextarea">
                    function(it){
                     if(it.id==1){
                        return true;
                        }
                    }
                    </textarea>
                </div>
                <div style="padding:10px;">
                    参数2<b>[Object]</b>：<input id="countCanshu2" type="text" value="" />
                </div>
                <div> <input id="countButton" type="button" value="执行 g.count(Array,String/Function,Object)" /> </div>
                <div>
                    显示结果
                </div>
                <div>
                    <textarea id="countOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#countButton").click(function () {
                        var objAry1 = JSON.parse($('#countInput').val());
                        var canshu1 = $('#countCanshu1').val();
                        var canshu2;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#countCanshu2').val() == '') {
                            canshu2 = null;
                        } else {
                            canshu2 = JSON.parse($('#countCanshu2').val());
                        }
                        var Num1 = g.count(objAry1, canshu1, canshu2);
                        //var objAry3 = g.count(objAry1, '*.state==@state', { state:1});
                        $('#countOutput').val(Num1);
                    });
                </script>
            </div>
        </div>

        <div id="getMinRow" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>getMinRow</strong> </span> <span class="title-type">Function(Array,String)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//*------求出数组中 最小的行--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">getMinRow</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Obj1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//Obj1就是'{"id":"1","name":"aa","state":"1"}';        </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//字段id最小的项就是 {"id":"1","name":"aa","state":"1"} </span></code></li><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">getMinRow</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'state'</span><span class="pun">);</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Obj1</span><span class="pun">);</span><span class="com">//Obj1就是'{"id":"2","name":"bb","state":"0"}'; </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//属性state最小的项是{"id":"2","name":"bb","state":"0"} </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//求最小的项前面优先</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.getMinRow(Array,String)<br />
                    //获取数组中某个字段最小的项<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="getMinRowInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px;">参数1<b>[String]</b>：<input id="getMinRowCanshu1" type="text" value="id" /></div>
                <div> <input id="getMinRowButton" type="button" value="执行 g.getMinRow(Array,String)" /> </div>

                <div>
                    显示结果JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="getMinRowOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#getMinRowButton").click(function () {
                        var objAry1 = JSON.parse($('#getMinRowInput').val());
                        var canshu1 = $('#getMinRowCanshu1').val();
                        if (canshu1 == '') {
                            canshu1 = null;
                        } else if (canshu1.indexOf('[') > -1) {
                            canshu1 = JSON.parse(canshu1);
                        }
                        var Obj1 = g.getMinRow(objAry1, canshu1);
                        $('#getMinRowOutput').val(JSON.stringify(Obj1));
                    });
                </script>
            </div>
        </div>

        <div id="getMaxRow" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>getMaxRow</strong> </span> <span class="title-type">Function(Array,String)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                   </span><span class="com">//*------求出数组中 最大的行--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">getMaxRow</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Obj1</span><span class="pun">);</span><span class="com">//字段id最大的项就是 {"id":"4","name":"dd","state":"0"}        </span></code></li><li class="L9"><code class="lang-javascript"></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2： </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">getMaxRow</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'state'</span><span class="pun">);</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Obj1</span><span class="pun">);</span><span class="com">//  Obj1就是'{"id":"1","name":"aa","state":"1"}' </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//属性state最大的项是{"id":"1","name":"aa","state":"1"} </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//求最大的项前面优先</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.getMaxRow(Array,String)<br />
                    //获取数组中某个字段最大的项<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="getMaxRowInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px;">参数1<b>[String]</b>：<input id="getMaxRowCanshu1" type="text" value="id" /></div>
                <div> <input id="getMaxRowButton" type="button" value="执行 g.getMaxRow(str)" /> </div>

                <div>
                    显示结果JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="getMaxRowOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#getMaxRowButton").click(function () {
                        var objAry1 = JSON.parse($('#getMaxRowInput').val());
                        var canshu1 = $('#getMaxRowCanshu1').val();
                        if (canshu1 == '') {
                            canshu1 = null;
                        } else if (canshu1.indexOf('[') > -1) {
                            canshu1 = JSON.parse(canshu1);
                        }
                        var Obj1 = g.getMaxRow(objAry1, canshu1);
                        $('#getMaxRowOutput').val(JSON.stringify(Obj1));
                    });
                </script>
            </div>
        </div>

        <div id="query" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>query</strong> </span> <span class="title-type">Function(Array,String/Function,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                   </span><span class="com">//*------求出数组中 查询数组中的数据--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                                 </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                                 </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                                 </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">query</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==1'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者  </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">query</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==@state'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">query</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">state </span><span class="pun">==</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="com">//效率最好 </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                             </span><span class="pun">});</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//不变 </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln">  </span><span class="com">//objAry2都是'[{"id":"1","name":"aa","state":"1"},{"id":"3","name":"cc","state":"1"}]'; </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 求出state== 1时，查询的项，都是最后一个效率最好</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.query(Array,String/Function,Object)<br />
                    //数组查询<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="queryInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="queryCanshu1" class="InputTextarea">
                      function (it) {
                if (it.state == 1) { return  true; } 
                             }
                   </textarea>
                </div>
                <div style="padding:10px;">参数2<b>[Object]</b>：<input id="queryCanshu2" type="text" value="" /></div>
                <div> <input id="queryButton" type="button" value="执行 g.query(Array,String/Function,Object)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) （原对象不会改变）JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="queryOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="queryOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#queryButton").click(function () {
                        var objAry1 = JSON.parse($('#queryInput').val());
                        var canshu1 = $('#queryCanshu1').val();
                        var canshu2;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#queryCanshu2').val() == '') {
                            canshu2 = null;
                        } else {
                            canshu2 = JSON.parse($('#queryCanshu2').val());
                        }
                        var objAry2 = g.query(objAry1, canshu1, canshu2);
                        //var objAry2 = g.query(objAry1, '*.state==@state', { state:1});
                        $('#queryOutput').val(JSON.stringify(objAry1));
                        $('#queryOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>



        <div id="prepart" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>prepart</strong> </span> <span class="title-type">Function(Array,String/Function,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                  </span><span class="com">//*------求出数组中 获取前半部分，包括该条数据--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">prepart</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.id==1'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者  </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">prepart</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.id==@id'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者  </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">prepart</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="com">//效率最好 </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">id </span><span class="pun">==</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">});</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//不变 </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln">  </span><span class="com">//objAry2都是'[{"id":"1","name":"aa","state":"1"}]';       </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 求出id== 1时，获取前面部分的行</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.prepart(Array,String/Function,Object)<br />
                    //获取条件的前半部分，包括该条数据<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="prepartInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="prepartCanshu1" class="InputTextarea">
                  function (it) {
                          if (it.id == 1) { return  true; }
                        }
                    </textarea>
                </div>
                <div style="padding:10px;">
                    参数2<b>[Object]</b>：<input id="prepartCanshu2" type="text" value="" />
                </div>
                <div> <input id="prepartButton" type="button" value="执行  g.prepart(Array,String/Function,Object)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) （原对象不会改变）JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="prepartOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="prepartOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#prepartButton").click(function () {
                        var objAry1 = JSON.parse($('#prepartInput').val());
                        var canshu1 = $('#prepartCanshu1').val();
                        var canshu2;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#prepartCanshu2').val() == '') {
                            canshu2 = null;
                        } else {
                            canshu2 = JSON.parse($('#prepartCanshu2').val());
                        }
                        var objAry2 = g.prepart(objAry1, canshu1, canshu2);
                        //var str3 = g.prepart(objAry1, '*.state==@state', { state:1});
                        $('#prepartOutput').val(JSON.stringify(objAry1));
                        $('#prepartOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="appart" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>appart</strong> </span> <span class="title-type">Function(Array,String/Function,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//*------求出数组中 获取后半部分，包括该条数据--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">appart</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.id==2'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">appart</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.id==@id'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">appart</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="com">//该方法效率最好 </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">id </span><span class="pun">==</span><span class="pln"> </span><span class="lit">2</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">}</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">});</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//不变 </span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2都是'[{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]';         </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 求出id== 2时，获取后面部分的项</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.appart(Array,String/Function,Object)<br />
                    //求出数组中 获取后半部分，包括该条数据<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="appartInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="appartCanshu1" class="InputTextarea">
                   function (it) {
                          if (it.id == 2) { return  true; }
                        }
                     </textarea>
                </div>
                <div style="padding:10px;">
                    参数2<b>[Object]</b>：<input id="appartCanshu2" type="text" value="" />
                </div>
                <div> <input id="appartButton" type="button" value="执行  g.appart(Array,String/Function,Object)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) （原对象不会改变）JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="appartOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="appartOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#appartButton").click(function () {
                        var objAry1 = JSON.parse($('#appartInput').val());
                        var canshu1 = $('#appartCanshu1').val();
                        var canshu2;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#appartCanshu2').val() == '') {
                            canshu2 = null;
                        } else {
                            canshu2 = JSON.parse($('#appartCanshu2').val());
                        }
                        var objAry2 = g.appart(objAry1, canshu1, canshu2);
                        //var objAry2 = g.appart(objAry1, '*.state==@state', { state:1});
                        $('#appartOutput').val(JSON.stringify(objAry1));
                        $('#appartOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="clearColumn" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>clearColumn</strong> </span> <span class="title-type">Function(Array,String/Array)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">          </span><span class="com">//*------求出数组中 删除相应字段的列的数组--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">clearColumn</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原来数组不变 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'[{"id":"1"},{"id":"2"},{"id":"3"},{"id":"4"}]';//删除字段为id的列       </span></code></li><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2：       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">clearColumn</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id,state'</span><span class="pun">);</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">clearColumn</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[</span><span class="str">"id"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">]);</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原来数组不变 </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="com">//objAry2就是'[{"id":"1","state":"1"},{"id":"2","state":"0"},{"id":"3","state":"1"},{"id":"4","state":"0"}]';        </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//删除字段为id和state的列</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.clearColumn(Array,String/Array)<br />
                    //求出数组中 获取相应字段的列的数组<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="clearColumnInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px;">
                    参数1<b>[String/Array]</b>：<input id="clearColumnCanshu1" type="text" value="id" />
                </div>
                <div> <input id="clearColumnButton" type="button" value="执行  g.clearColumn(Array,String/Array)" /> </div>
                <div>
                    显示结果（<b>原数组</b>数组）（原对象不会改变）JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="clearColumnOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>数组）JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="clearColumnOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#clearColumnButton").click(function () {
                        var objAry1 = JSON.parse($('#clearColumnInput').val());
                        var canshu1 = $('#clearColumnCanshu1').val();
                        if (canshu1 == '') {
                            canshu1 = null;
                        } else if (canshu1.indexOf('[') > -1) {
                            canshu1 = JSON.parse(canshu1);
                        }
                        var objAry2 = g.clearColumn(objAry1, canshu1);
                        $('#clearColumnOutput').val(JSON.stringify(objAry1));
                        $('#clearColumnOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>



        <div id="retainColumn" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>retainColumn</strong> </span> <span class="title-type">Function(Array,String/Array)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">           </span><span class="com">//*------求出数组中 获取相应字段的列的数组--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">retainColumn</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原来数组不变 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'[{"id":"1"},{"id":"2"},{"id":"3"},{"id":"4"}]';//保留字段为id的列       </span></code></li><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2：       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">retainColumn</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id,state'</span><span class="pun">);</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">retainColumn</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[</span><span class="str">"id"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">]);</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原来数组不变 </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="com">//objAry2就是'[{"id":"1","state":"1"},{"id":"2","state":"0"},{"id":"3","state":"1"},{"id":"4","state":"0"}]';        </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//保留字段为id和state的列</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.retainColumn(Array,String/Array)<br />
                    //求出数组中 获取相应字段的列的数组<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="retainColumnInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px;">
                    参数1<b>[String/Array]</b>：<input id="retainColumnCanshu1" type="text" value="id" />
                </div>
                <div> <input id="retainColumnButton" type="button" value="执行  g.retainColumn(Array,String/Array)" /> </div>
                <div>
                    显示结果（<b>原数组</b>数组）（原对象不会改变）JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="retainColumnOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>数组）JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="retainColumnOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#retainColumnButton").click(function () {
                        var objAry1 = JSON.parse($('#retainColumnInput').val());
                        var canshu1 = $('#retainColumnCanshu1').val();
                        if (canshu1 == '') {
                            canshu1 = null;
                        } else if (canshu1.indexOf('[') > -1) {
                            canshu1 = JSON.parse(canshu1);
                        }
                        var objAry2 = g.retainColumn(objAry1, canshu1);
                        $('#retainColumnOutput').val(JSON.stringify(objAry1));
                        $('#retainColumnOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="tranTreeData" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>tranTreeData</strong> </span> <span class="title-type">Function(Array,String,String,String)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">            </span><span class="com">//*------根据父字段和子字段将数组转为树节点结构--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"pid"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"pid"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"pid"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"pid"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">tranTreeData</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'pid'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'children'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//将数组根据id,pid父子关系，转为children </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry1不变 objAry2的结果如下' </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2</span><span class="pun">=</span><span class="pln">  </span><span class="pun">[{</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"pid"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"children"</span><span class="pun">:</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">[{</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"pid"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"children"</span><span class="pun">:</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"pid"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}]</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">}</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">,{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"pid"</span><span class="pun">:</span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="str">"1"</span><span class="pln"> </span><span class="pun">}</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">]</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                   </span><span class="pun">}];</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.tranTreeData(Array,String1,String2,String3)<br />
                    //将表结构转为树结构<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="tranTreeDataInput" class="InputTextarea">[{"id":"1","pid":"0","name":"aa","state":"1"},{"id":"2","pid":"1","name":"bb","state":"0"},{"id":"3","pid":"1","name":"cc","state":"1"},{"id":"4","pid":"2","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数1<b>[String1]</b>：<input id="tranTreeDataCanshu1" type="text" value="id" /><br>
                    参数2<b>[String2]</b>：<input id="tranTreeDataCanshu2" type="text" value="pid" /><br>
                    参数3<b>[String3]</b>：<input id="tranTreeDataCanshu3" type="text" value="children" />
                </div>
                <div> <input id="tranTreeDataButton" type="button" value="执行 g.tranTreeData(Array,String1,String2,String3)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) （原对象不会改变）JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="tranTreeDataOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="tranTreeDataOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#tranTreeDataButton").click(function () {
                        var objAry1 = JSON.parse($('#tranTreeDataInput').val());
                        var canshu1 = $('#tranTreeDataCanshu1').val();
                        var canshu2 = $('#tranTreeDataCanshu2').val();
                        var canshu3 = $('#tranTreeDataCanshu3').val();

                        var objAry2 = g.tranTreeData(objAry1, canshu1, canshu2, canshu3);
                        //var objAry2 = g.tranTreeData(objAry1, '*.state==@state', { state:1});
                        $('#tranTreeDataOutput').val(JSON.stringify(objAry1));
                        $('#tranTreeDataOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="changeToArrays" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>changeToArrays</strong> </span> <span class="title-type">Function(Array,String/Array)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">           </span><span class="com">//*------将对象数组中某些项转为指定的数组--------*/             </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">changeToArrays</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln">    </span><span class="com">//objAry2就是'["1","2","3","4"]';</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2： </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">changeToArrays</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id,state'</span><span class="pun">);</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">changeToArrays</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[</span><span class="str">"id"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">]);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="com">//  objAry2就是'{"id":["1","2","3","4"],"state":["1","0","1","0"]}';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.changeToArrays(Array,String/Array)<br />
                    //将对象数组中某些项转为指定的数组<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="changeToArraysInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px;line-height:32px;">参数1<b>[String/Array]</b>：<input id="changeToArraysCanshu1" type="text" value="id" /></div>
                <div> <input id="changeToArraysButton" type="button" value="执行 g.changeToArrays(Array,String/Array)" /> </div>

                <div>
                    显示结果JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="changeToArraysOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#changeToArraysButton").click(function () {
                        var objAry1 = JSON.parse($('#changeToArraysInput').val());
                        var canshu1 = $('#changeToArraysCanshu1').val();
                        if (canshu1 == '') {
                            canshu1 = null;
                        } else if (canshu1.indexOf('[') > -1) {
                            canshu1 = JSON.parse(canshu1);
                        }
                        var objAry2 = g.changeToArrays(objAry1, canshu1);
                        $('#changeToArraysOutput').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>



        <div id="toHash" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>toHash</strong> </span> <span class="title-type">Function(Array,String)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">             </span><span class="com">//*------将数据转为hash对象--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> Obj1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">toHash</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">Obj1</span><span class="pun">);</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">    </span><span class="com">//hash对象</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">    </span><span class="com">//{"1":{"id":"1","name":"aa","state":"1"},"2":{"id":"2","name":"bb","state":"0"},"3":{"id":"3","name":"cc","state":"1"},"4":{"id":"4","name":"dd","state":"0"}}</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.toHash(Array,String)<br />
                    //将数据转为hash，便于快速查询<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="toHashInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px;">参数1<b>[String]</b>：<input id="toHashCanshu1" type="text" value="id" /></div>
                <div> <input id="toHashButton" type="button" value="执行 g.toHash(str)" /> </div>

                <div>
                    显示结果JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="toHashOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#toHashButton").click(function () {
                        var objAry1 = JSON.parse($('#toHashInput').val());
                        var canshu1 = $('#toHashCanshu1').val();
                        if (canshu1 == '') {
                            canshu1 = null;
                        } else if (canshu1.indexOf('[') > -1) {
                            canshu1 = JSON.parse(canshu1);
                        }
                        var Obj1 = g.toHash(objAry1, canshu1);
                        $('#toHashOutput').val(JSON.stringify(Obj1));
                    });
                </script>
            </div>
        </div>



        <div id="removeRepeatAttr" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>removeRepeatAttr</strong> </span> <span class="title-type">Function(Array,String)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">              </span><span class="com">//*------去掉数组中重复的行--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"5"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">removeRepeatAttr</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'state'</span><span class="pun">);</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//objAry1不变 </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry2就是'[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"}]';   </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//去掉objAry1数组中state字段重复的行</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.removeRepeatAttr(Array,String)<br />
                    //去掉数组中重复的行<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="removeRepeatAttrInput" class="InputTextarea">[{ "id": "1", "name": "aa", "state": "1" },{ "id": "2", "name": "bb", "state": "0" },{ "id": "3", "name": "cc", "state": "1" },{ "id": "4", "name": "dd", "state": "0" },{ "id": "5", "name": "bb", "state": "0" }]</textarea>
                </div>
                <div style="padding:10px;">
                    参数1<b>[String/Array]</b>：<input id="removeRepeatAttrCanshu1" type="text" value="state" />
                </div>
                <div> <input id="removeRepeatAttrButton" type="button" value="执行 g.removeRepeatAttr(Array,String)" /> </div>
                <div>
                    显示结果（<b>原数组</b>数组）（原对象不会改变）JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="removeRepeatAttrOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>数组）JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="removeRepeatAttrOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#removeRepeatAttrButton").click(function () {
                        var objAry1 = JSON.parse($('#removeRepeatAttrInput').val());
                        var canshu1 = $('#removeRepeatAttrCanshu1').val();
                        if (canshu1 == '') {
                            canshu1 = null;
                        } else if (canshu1.indexOf('[') > -1) {
                            canshu1 = JSON.parse(canshu1);
                        }
                        var objAry2 = g.removeRepeatAttr(objAry1, canshu1);
                        $('#removeRepeatAttrOutput').val(JSON.stringify(objAry1));
                        $('#removeRepeatAttrOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="sortBy" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>sortBy</strong> </span> <span class="title-type">Function(Array,[Object/Array],String,String,Bealon)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" data-anchor-id="aoa0" style=""><ol class="linenums"><li class="L0"><code class="language-javascript"></code></li><li class="L1"><code class="language-javascript"></code></li><li class="L2"><code class="language-javascript"><span class="pln">  </span><span class="com">//*------将数组排序--------*/       </span></code></li><li class="L3"><code class="language-javascript"><span class="pln">        </span><span class="com">//例如1： </span></code></li><li class="L4"><code class="language-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="language-javascript"><span class="pln">        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="language-javascript"><span class="pln">        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="language-javascript"><span class="pln">        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L8"><code class="language-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">sortBy</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'Number'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="com">//根据id字段正序 </span></code></li><li class="L9"><code class="language-javascript"><span class="pln">        </span><span class="com">//或者</span></code></li><li class="L0"><code class="language-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">sortBy</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"filed"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"primer"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Number"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rev"</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">});</span><span class="com">//根据id字段正序 </span></code></li><li class="L1"><code class="language-javascript"><span class="pln">        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L2"><code class="language-javascript"><span class="pln">        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L3"><code class="language-javascript"><span class="pln">        </span><span class="com">//objAry1和objAry2都是是'[{"id":"1","name":"cc","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]'; </span></code></li><li class="L4"><code class="language-javascript"><span class="pln">        </span><span class="com">//例如2： </span></code></li><li class="L5"><code class="language-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">sortBy</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'Number'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">);</span><span class="com">//根据id字段反序 </span></code></li><li class="L6"><code class="language-javascript"><span class="pln">        </span><span class="com">//或者</span></code></li><li class="L7"><code class="language-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">sortBy</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"filed"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"primer"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Number"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rev"</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">});</span><span class="com">//根据id字段反序 </span></code></li><li class="L8"><code class="language-javascript"><span class="pln">        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L9"><code class="language-javascript"><span class="pln">        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L0"><code class="language-javascript"><span class="pln">        </span><span class="com">//objAry1和objAry2都是是'[{"id":"4","name":"dd","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"1","name":"cc","state":"1"}]'; </span></code></li><li class="L1"><code class="language-javascript"><span class="pln">        </span><span class="com">//例如3： </span></code></li><li class="L2"><code class="language-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">sortBy</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'name'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'string'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">);</span><span class="com">//根据name字段反序</span></code></li><li class="L3"><code class="language-javascript"><span class="pln">        </span><span class="com">//或者</span></code></li><li class="L4"><code class="language-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">sortBy</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"filed"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"primer"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"string"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rev"</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pln"> </span><span class="pun">});</span><span class="com">//根据name字段反序 </span></code></li><li class="L5"><code class="language-javascript"><span class="pln">        </span><span class="com">// objAry1和objAry2都是'[{"id":"4","name":"dd","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"1","name":"cc","state":"1"}]';</span></code></li><li class="L6"><code class="language-javascript"></code></li><li class="L7"><code class="language-javascript"><span class="pln">        </span><span class="com">//例子4：多个字段先后排序</span></code></li><li class="L8"><code class="language-javascript"></code></li><li class="L9"><code class="language-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">sortBy</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[</span></code></li><li class="L0"><code class="language-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"filed"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"primer"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"string"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rev"</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="com">//先按name反序</span></code></li><li class="L1"><code class="language-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"filed"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"primer"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"number"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rev"</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="com">//再按state正序 默认就是正序</span></code></li><li class="L2"><code class="language-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"filed"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"primer"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"number"</span><span class="pln"> </span><span class="pun">}</span><span class="com">//再按id正序 默认就是正序</span></code></li><li class="L3"><code class="language-javascript"><span class="pln">        </span><span class="pun">]);</span><span class="pln">     </span></code></li><li class="L4"><code class="language-javascript"><span class="pln">        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L5"><code class="language-javascript"><span class="pln">        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L6"><code class="language-javascript"><span class="pln">        </span><span class="com">// objAry1和objAry2都是'[{"id":"4","name":"dd","state":"0"},{"id":"1","name":"cc","state":"1"},{"id":"3","name":"cc","state":"1"},{"id":"2","name":"bb","state":"0"}]';</span></code></li><li class="L7"><code class="language-javascript"></code></li><li class="L8"><code class="language-javascript"><span class="pln">        </span><span class="com">//多个字段先后排序</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.sortBy(Array,[Object/Array],String1,String2,Bealon);<br />
                    //[Object/Array] 默认为先处理，后面就不处理，没有[Object/Array]就处理后面的参数<br />
                    //[Object/Array] 可以是<br />
                    //将数组根据某个字段排序<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="sortByInput" class="InputTextarea">[{"id":"1","name":"cc","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px; line-height:32px;">
                    参数1<b>[String1]</b>：<input id="sortByCanshu1" type="text" value="id" /><br />
                    参数2<b>[String2]</b>：<input id="sortByCanshu2" type="text" value="number" /><br />
                    参数3<b>[Bealon]</b>：<input id="sortByCanshu3" type="text" value="true" /><br />
                </div>
                <div>
                    请输入排序条件<b>[Object/Array]</b>（对象中用JSON.parse(String)
                </div>
                <div>
                    <textarea id="sortByInput1" class="InputTextarea">[{ "filed": "name", "primer": "string", "rev": true },{ "filed": "state", "primer": "number", "rev": true },{ "filed": "id", "primer": "number" }]</textarea>
                </div>
                <div> <input id="sortByButton" type="button" value="执行 g.sortBy(Array,String1,String2,Bealon)" /> </div>
                <div>
                    显示结果（<b>原数组</b>数组）<span class="font-red">（原数组会改变）</span>JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="sortByOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>数组）JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="sortByOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#sortByButton").click(function () {
                        var objAry1 = JSON.parse($('#sortByInput').val());
                        var canshu1 = $('#sortByCanshu1').val();
                        var canshu2 = $('#sortByCanshu2').val();
                        var canshu3 = eval($('#sortByCanshu3').val());
                        var objAry2 = JSON.parse($('#sortByInput1').val() || null) || null;
                        var objAry2 = g.sortBy(objAry1, canshu1, canshu2, canshu3, objAry2);
                        $('#sortByOutput').val(JSON.stringify(objAry1));
                        $('#sortByOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>


        <div id="reverse" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">Array.<strong>reverse</strong> </span> <span class="title-type">Function()</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">               </span><span class="com">//*------数据反向--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> objAry1</span><span class="pun">.</span><span class="pln">reverse</span><span class="pun">();</span><span class="com">//数据反向 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                </span><span class="com">// objAry1是'[{"id":"4","name":"dd","state":"0"},{"id":"3","name":"cc","state":"1"},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                        </span><span class="com">//{"id":"2","name":"bb","state":"0"},{"id":"1","name":"aa","state":"1"}]'; </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                        </span><span class="com">// objAry2是'[{"id":"4","name":"dd","state":"0"},{"id":"3","name":"cc","state":"1"},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                       </span><span class="com">// {"id":"2","name":"bb","state":"0"},{"id":"1","name":"aa","state":"1"}]';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    Array.reverse()//数据反向<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="reverseInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div> <input id="reverseButton" type="button" value="执行 Array.reverse()" /> </div>
                <div>
                    显示结果(<b>原数组</b>) <span class="font-red">（原数组会改变）</span>JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="reverseOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="reverseOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#reverseButton").click(function () {
                        var objAry1 = JSON.parse($('#reverseInput').val());
                        var objAry2 = objAry1.reverse();
                        //var str3 = g.reverse(objAry1, '*.state==@state', { state:1});
                        $('#reverseOutput').val(JSON.stringify(objAry1));
                        $('#reverseOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>


        <div id="page" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>page</strong> </span> <span class="title-type">Function(Array,Number,Number)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="com">//*------获取数组中分页的数据--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1：     </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">page</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">);</span><span class="com">//第1页的数据每1页大小为2 </span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原数组不变 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry2都是是'[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"}]'; </span></code></li><li class="L1"><code class="lang-javascript"></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如2：        </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">page</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">);</span><span class="com">//第2页的数据每1页大小为2 </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原数组不变 </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry2都是是'[{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]';</span></code></li><li class="L7"><code class="lang-javascript"></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">page</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">3</span><span class="pun">);</span><span class="com">//第2页的数据每1页大小为3 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原数组不变 </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry2都是'[{"id":"4","name":"dd","state":"0"}]';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.page(Array,Number1,Number2);<br />
                    //获取分页，Number1表示页码，Number2表示页面大小<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="pageInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div style="padding:10px; line-height:32px;">
                    参数1<b>[Number1]</b>：<input id="pageCanshu1" type="text" value="1" /><br />
                    参数2<b>[Number2]</b>：<input id="pageCanshu2" type="text" value="2" /><br />
                </div>
                <div> <input id="pageButton" type="button" value="执行 g.page(Array,Number1,Number2)" /> </div>
                <div>
                    显示结果（<b>原数组</b>数组）（原对象不会改变）JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="pageOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>数组）JSON.stringify(Object)
                </div>
                <div>
                    <textarea id="pageOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#pageButton").click(function () {
                        var objAry1 = JSON.parse($('#pageInput').val());
                        var canshu1 = parseInt($('#pageCanshu1').val());
                        var canshu2 = parseInt($('#pageCanshu2').val());
                        var objAry2 = g.page(objAry1, canshu1, canshu2);
                        $('#pageOutput').val(JSON.stringify(objAry1));
                        $('#pageOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="removed" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>removed</strong> </span> <span class="title-type">Function(Array,String/Function,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                   </span><span class="com">//*------删除数组中的数据--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如1：     </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">removed</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==1'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">removed</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==@state'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者  </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">removed</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">state </span><span class="pun">==</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="pun">});</span><span class="com">//效率最高 </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="pln">  </span><span class="com">// objAry1都是'[{"id":"2","name":"bb","state":"0"},{"id":"4","name":"dd","state":"0"}]'; </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span><span class="com">// objAry2都是'[{"id":"1","name":"aa","state":"1"},{"id":"3","name":"cc","state":"1"}]'; </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 将state== 1的项全部删除掉，返回，被删除的</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.removed(Array,String/Function,Object)<br />
                    //删除数组中的行<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="removedInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="removedCanshu1" class="InputTextarea">
               function(it){
                     if(it.state==1){
                        return true;
                        }
                    }
              </textarea>
                </div>
                <div style="padding:10px;">
                    参数2<b>[Object]</b>：
                    <input id="removedCanshu2" type="text" value="" />
                </div>
                <div> <input id="removedButton" type="button" value="执行  g.removed(Array,String/Function,Object)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) <span class="font-red">（原数组会改变）</span>JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="removedOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="removedOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#removedButton").click(function () {
                        var objAry1 = JSON.parse($('#removedInput').val());
                        var canshu1 = $('#removedCanshu1').val();
                        var canshu2;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#removedCanshu2').val() == '') {
                            canshu2 = null;
                        } else {
                            canshu2 = JSON.parse($('#removedCanshu2').val());
                        }
                        var objAry2 = g.removed(objAry1, canshu1, canshu2);
                        //var objAry2 = g.removed(objAry1, '*.state==@state', { state:1});
                        $('#removedOutput').val(JSON.stringify(objAry1));
                        $('#removedOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="remain" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>remain</strong> </span> <span class="title-type">Function(Array,String/Function,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//*------保留数组中的数据--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">remain</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==1'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">remain</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==@state'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">remain</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">state </span><span class="pun">==</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">// objAry1都是'[{"id":"1","name":"aa","state":"1"},{"id":"3","name":"cc","state":"1"}]'; </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="com">// objAry2都是'[{"id":"2","name":"bb","state":"0"},{"id":"4","name":"dd","state":"0"}]'; </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 将state== 1的项全部保留，返回被删除的</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.remain(Array,String/Function,Object)<br />
                    //保留指定条件的项  与g.removed()相反<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="remainInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="remainCanshu1" class="InputTextarea">
                   function(it){
                     if(it.state==1){
                        return true;
                        }
                    }
          </textarea>
                </div>
                <div style="padding:10px;">参数2<b>[Object]</b>：<input id="remainCanshu2" type="text" value="" /></div>
                <div> <input id="remainButton" type="button" value="执行 g.remain(Array,String/Function,Object)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) <span class="font-red">（原数组会改变）</span>JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="remainOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="remainOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#remainButton").click(function () {
                        var objAry1 = JSON.parse($('#remainInput').val());
                        var canshu1 = $('#remainCanshu1').val();
                        var canshu2;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#remainCanshu2').val() == '') {
                            canshu2 = null;
                        } else {
                            canshu2 = JSON.parse($('#remainCanshu2').val());
                        }
                        var objAry2 = g.remain(objAry1, canshu1, canshu2);
                        //var objAry2 = g.remain(objAry1, '*.state==@state', { state:1});
                        $('#remainOutput').val(JSON.stringify(objAry1));
                        $('#remainOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="clear" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>clear</strong> </span> <span class="title-type">Function(Array,Array,Array,Array,......)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="com">//*------清空数组--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">clear</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//快速清空 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">// objAry1是'[]'; </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="com">// objAry2是'[]';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.clear(Array,Array,Array,Array,Array,....)//几个数组一起清空<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="clearInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div> <input id="clearButton" type="button" value="执行 g.clear(Array)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) <span class="font-red">（原数组会改变）</span>JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="clearOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="clearOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#clearButton").click(function () {
                        var objAry1 = JSON.parse($('#clearInput').val());
                        var objAry2 = g.clear(objAry1);
                        //var objAry2 = g.clear(objAry1, '*.state==@state', { state:1});
                        $('#clearOutput').val(JSON.stringify(objAry1));
                        $('#clearOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="preInsert" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>preInsert</strong> </span> <span class="title-type">Function(Array,String/Function,Object,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">               </span><span class="com">//*------在前面插入一行--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">preInsert</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==1'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"9"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"mm"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">preInsert</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==@state'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"9"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"mm"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">preInsert</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">state </span><span class="pun">==</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="com">//效率最高 </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                       </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"9"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"mm"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span><span class="pln"> </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 将state== 1的项前面加一个{"id":"9", "name":"mm", "state":"1" } </span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry1都是'[{"id":"9","name":"mm","state":"1"}, </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"1", "name":"aa", "state":"1" }, </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"2", "name":"bb", "state":"0" }, </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"9", "name":"mm", "state":"1" }, </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"3", "name":"cc", "state":"1" }, </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"4", "name":"dd", "state":"0" }]'; </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry2都是'[{"id":"9","name":"mm","state":"1"}, </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"1", "name":"aa", "state":"1" }, </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"2", "name":"bb", "state":"0" }, </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"9", "name":"mm", "state":"1" }, </span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"3", "name":"cc", "state":"1" }, </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"4", "name":"dd", "state":"0" }]';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.preInsert(Array,String/Function,Object1,Object2)<br />
                    //在指定的条件的项前面添加一行  <br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="preInsertInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="preInsertCanshu1" class="InputTextarea">   
                  function(it){
                     if(it.state==1){
                        return true;
                        }
                    }
              </textarea>
                </div>
                <div>
                    参数2<b>[Object1]</b>
                </div>
                <div>
                    <textarea id="preInsertCanshu2" class="InputTextarea">{"id":"9","name":"mm","state":"1"}</textarea>
                </div>
                <div style="padding:10px;">参数3<b>[Object2]</b>：<input id="preInsertCanshu3" type="text" value="" /></div>
                <div> <input id="preInsertButton" type="button" value="执行 g.preInsert(Array,String/Function,Object1,Object2)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) <span class="font-red">（原数组会改变）</span>JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="preInsertOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="preInsertOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#preInsertButton").click(function () {
                        var objAry1 = JSON.parse($('#preInsertInput').val());
                        var canshu1 = $('#preInsertCanshu1').val();
                        var canshu2 = JSON.parse($('#preInsertCanshu2').val());
                        var canshu3;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#preInsertCanshu3').val() == '') {
                            canshu3 = null;
                        } else {
                            canshu3 = JSON.parse($('#preInsertCanshu3').val());
                        }
                        var objAry2 = g.preInsert(objAry1, canshu1, canshu2, canshu3);
                        //var objAry2 = g.preInsert(objAry1, '*.state==@state', { state:1});
                        $('#preInsertOutput').val(JSON.stringify(objAry1));
                        $('#preInsertOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="apInsert" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>apInsert</strong> </span> <span class="title-type">Function(Array,String/Function,Object,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">          </span><span class="com">//*------在后面插入一行--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">apInsert</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==1'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"9"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"mm"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">apInsert</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==@state'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"9"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"mm"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">apInsert</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">state </span><span class="pun">==</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"9"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"mm"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L4"><code class="lang-javascript"></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 将state== 1的项后面加一行{"id":"9", "name":"mm", "state":"1" } </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry1和objAry2都是'[{"id":"1","name":"aa","state":"1"},{"id":"9","name":"mm","state":"1"}, </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"2", "name":"bb", "state":"0" },{ "id":"3", "name":"cc", "state":"1" }, </span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"9", "name":"mm", "state":"1" },{ "id":"4", "name":"dd", "state":"0" }]';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.apInsert(Array,String/Function,Object1,Object2)<br />
                    //在指定的条件的项后面添加一行  <br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="apInsertInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="apInsertCanshu1" class="InputTextarea"> function(it){
                     if(it.state==1){
                        return true;
                        }
                    }
                  </textarea>
                </div>
                <div>
                    参数2<b>[Object1]</b>
                </div>
                <div>
                    <textarea id="apInsertCanshu2" class="InputTextarea">{"id":"9","name":"mm","state":"1"}</textarea>
                </div>
                <div style="padding:10px;">参数3<b>[Object2]</b>：<input id="apInsertCanshu3" type="text" value="" /></div>
                <div> <input id="apInsertButton" type="button" value="执行   g.apInsert(Array,String/Function,Object1,Object2)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) <span class="font-red">（原数组会改变）</span>JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="apInsertOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="apInsertOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#apInsertButton").click(function () {
                        var objAry1 = JSON.parse($('#apInsertInput').val());
                        var canshu1 = $('#apInsertCanshu1').val();
                        var canshu2 = JSON.parse($('#apInsertCanshu2').val());
                        var canshu3;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#apInsertCanshu3').val() == '') {
                            canshu3 = null;
                        } else {
                            canshu3 = JSON.parse($('#apInsertCanshu3').val());
                        }
                        var objAry2 = g.apInsert(objAry1, canshu1, canshu2, canshu3);
                        //var objAry2 = g.apInsert(objAry1, '*.state==@state', { state:1});
                        $('#apInsertOutput').val(JSON.stringify(objAry1));
                        $('#apInsertOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="preInserts" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>preInserts</strong> </span> <span class="title-type">Function(Array,String/Function,Array,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">         </span><span class="com">//*------在前面插入几行--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">preInserts</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==1'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"9"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"mm"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"10"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"nn"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pln"> </span><span class="pun">}]);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">preInserts</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==@state'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"9"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"mm"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"10"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"nn"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pln"> </span><span class="pun">}]);</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">preInserts</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">state </span><span class="pun">==</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"9"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"mm"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"10"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"nn"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pln"> </span><span class="pun">}]);</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 将state== 1的项前面加2行 [{ "id": "9", "name": "mm", "state": "1" }, { "id": "10", "name": "nn", "state": "2" }] </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry2和objAry1都是'[{"id":"9","name":"mm","state":"1"},{"id":"10","name":"nn","state":"2"},{"id":"1","name":"aa","state":"1"}, </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"2", "name":"bb", "state":"0" },{ "id":"9", "name":"mm", "state":"1" }, </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"10", "name":"nn", "state":"2" },{ "id":"3", "name":"cc", "state":"1" },{ "id":"4", "name":"dd", "state":"0" }];</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.preInserts(Array,String/Function,Array1,Object1)<br />
                    //在指定的条件的项前面添加一个Array1 就是数组(就是几行)  <br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="preInsertsInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="preInsertsCanshu1" class="InputTextarea"> function(it){
                     if(it.state==1){
                        return true;
                        }
                    }</textarea>
                </div>
                <div>
                    参数2<b>[Array1]</b>
                </div>
                <div>
                    <textarea id="preInsertsCanshu2" class="InputTextarea">[{"id":"9","name":"mm","state":"1"},{"id":"10","name":"nn","state":"2"}]</textarea>
                </div>
                <div style="padding:10px;">参数3<b>[Object1]</b>：<input id="preInsertsCanshu3" type="text" value="" /></div>
                <div> <input id="preInsertsButton" type="button" value="执行 g.preInserts(Array,String/Function,Array1,Object1)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) <span class="font-red">（原数组会改变）</span>JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="preInsertsOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="preInsertsOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#preInsertsButton").click(function () {
                        var objAry1 = JSON.parse($('#preInsertsInput').val());
                        var canshu1 = $('#preInsertsCanshu1').val();
                        var canshu2 = JSON.parse($('#preInsertsCanshu2').val());
                        var canshu3;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#preInsertsCanshu3').val() == '') {
                            canshu3 = null;
                        } else {
                            canshu3 = JSON.parse($('#preInsertsCanshu3').val());
                        }
                        var objAry2 = g.preInserts(objAry1, canshu1, canshu2, canshu3);
                        //var objAry2 = g.preInserts(objAry1, '*.state==@state', { state:1});
                        $('#preInsertsOutput').val(JSON.stringify(objAry1));
                        $('#preInsertsOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="apInserts" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>apInserts</strong> </span> <span class="title-type">Function(Array,String/Function,Array,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">          </span><span class="com">//*------在后面插入几行--------*/       </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">apInserts</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==1'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"9"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"mm"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"10"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"nn"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pln"> </span><span class="pun">}]);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">apInserts</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==@state'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"9"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"mm"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"10"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"nn"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pln"> </span><span class="pun">}]);</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">apInserts</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">state </span><span class="pun">==</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">},</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                       </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"9"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"mm"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"10"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"nn"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pln"> </span><span class="pun">}]);</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L7"><code class="lang-javascript"></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 将state== 1的项后面加一个{"id":"9", "name":"mm", "state":"1" } </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry1和objAry2都是'[{"id":"1","name":"aa","state":"1"},{"id":"9","name":"mm","state":"1"},{"id":"10","name":"nn","state":"2"}, </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"2", "name":"bb", "state":"0" },{ "id":"3", "name":"cc", "state":"1" }, </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"9", "name":"mm", "state":"1" },{ "id":"10", "name":"nn", "state":"2" },{ "id":"4", "name":"dd", "state":"0" }]';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.apInserts(Array,String/Function,Array1,Object2)<br />
                    //在指定的条件的项后面添加一个Array1（添加几行）  <br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="apInsertsInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="apInsertsCanshu1" class="InputTextarea"> function(it){
                     if(it.state==1){
                        return true;
                        }
                    }</textarea>
                </div>
                <div>
                    参数2<b>[Array1]</b>
                </div>
                <div>
                    <textarea id="apInsertsCanshu2" class="InputTextarea">[{"id":"9","name":"mm","state":"1"},{"id":"10","name":"nn","state":"2"}]</textarea>
                </div>
                <div style="padding:10px;">参数3<b>[Object2]</b>：<input id="apInsertsCanshu3" type="text" value="" /></div>
                <div> <input id="apInsertsButton" type="button" value="执行  g.apInserts(Array,String/Function,Array1,Object2)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) <span class="font-red">（原数组会改变）</span>JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="apInsertsOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="apInsertsOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#apInsertsButton").click(function () {
                        var objAry1 = JSON.parse($('#apInsertsInput').val());
                        var canshu1 = $('#apInsertsCanshu1').val();
                        var canshu2 = JSON.parse($('#apInsertsCanshu2').val());
                        var canshu3;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#apInsertsCanshu3').val() == '') {
                            canshu3 = null;
                        } else {
                            canshu3 = JSON.parse($('#apInsertsCanshu3').val());
                        }
                        var objAry2 = g.apInserts(objAry1, canshu1, canshu2, canshu3);
                        //var objAry2 = g.apInserts(objAry1, '*.state==@state', { state:1});
                        $('#apInsertsOutput').val(JSON.stringify(objAry1));
                        $('#apInsertsOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="config" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>config</strong> </span> <span class="title-type">Function(Array,String/Function,String,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">           </span><span class="com">//*------在后面插入几行--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">config</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==1'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.text="可以"'</span><span class="pun">);</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">config</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.state==@state'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">,</span><span class="pln"> </span><span class="str">'*.text="可以"'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">config</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">state </span><span class="pun">==</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                                it</span><span class="pun">.</span><span class="pln">text </span><span class="pun">=</span><span class="pln"> </span><span class="str">'可以'</span><span class="pun">;</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                            </span><span class="pun">}</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">});</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li><li class="L6"><code class="lang-javascript"></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 将state== 1的项中text修改为‘可以’ </span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry1和objAry2都是'[{"id":"1","name":"aa","state":"1","text":"可以"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1","text":"可以"},{"id":"4","name":"dd","state":"0"}]';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.config(Array,String/Function,String,Object)<br />
                    //修改行修改数据<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="configInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="configCanshu1" class="InputTextarea"> function(it){
                     if(it.state==1){
                        it.text="可以";
                        it.name="kaixin";
                        }
                    }</textarea>
                </div>
                <div>
                    参数2<b>[String]</b>
                </div>
                <div>
                    <textarea id="configCanshu2" class="InputTextarea"></textarea>
                </div>
                <div style="padding:10px;">参数3<b>[Object]</b>：<input id="configCanshu3" type="text" value="" /></div>
                <div> <input id="configButton" type="button" value="执行 g.config(Array,String/Function,String,Object)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) <span class="font-red">（原数组会改变）</span>JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="configOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="configOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#configButton").click(function () {
                        var objAry1 = JSON.parse($('#configInput').val());
                        var canshu1 = $('#configCanshu1').val();
                        var canshu2 = $('#configCanshu2').val();
                        var canshu3;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#configCanshu3').val() == '') {
                            canshu3 = null;
                        } else {
                            canshu3 = JSON.parse($('#configCanshu3').val());
                        }
                        var objAry2 = g.config(objAry1, canshu1, canshu2, canshu3);
                        //var objAry2 = g.config(objAry1, '*.state==@state', { state:1});
                        $('#configOutput').val(JSON.stringify(objAry1));
                        $('#configOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>


        <div id="each" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>each</strong> </span> <span class="title-type">Function(Array,Function)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" data-anchor-id="aoa0" style=""><ol class="linenums"><li class="L0"><code class="language-javascript"></code></li><li class="L1"><code class="language-javascript"><span class="pln">        </span><span class="com">//*------将数组/对象遍历--------*/       </span></code></li><li class="L2"><code class="language-javascript"><span class="pln">        </span><span class="com">//例如1： </span></code></li><li class="L3"><code class="language-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L4"><code class="language-javascript"><span class="pln">        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="language-javascript"><span class="pln">        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="language-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L7"><code class="language-javascript"><span class="pln">        g</span><span class="pun">.</span><span class="pln">each</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">,</span><span class="pln"> idx</span><span class="pun">,</span><span class="pln"> obj</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li class="L8"><code class="language-javascript"><span class="pln">            </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">idx </span><span class="pun">==</span><span class="pln"> </span><span class="lit">0</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">   </span><span class="com">//idx是位置</span></code></li><li class="L9"><code class="language-javascript"><span class="pln">                obj</span><span class="pun">[</span><span class="pln">idx</span><span class="pun">].</span><span class="pln">state </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln"> </span><span class="com">//obj就是该数组</span></code></li><li class="L0"><code class="language-javascript"><span class="pln">                </span><span class="kwd">return</span><span class="pun">;</span></code></li><li class="L1"><code class="language-javascript"><span class="pln">            </span><span class="pun">}</span></code></li><li class="L2"><code class="language-javascript"><span class="pln">            </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">.</span><span class="pln">id </span><span class="pun">==</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="com">//it是遍历到的项</span></code></li><li class="L3"><code class="language-javascript"><span class="pln">                it</span><span class="pun">.</span><span class="pln">name </span><span class="pun">=</span><span class="pln"> </span><span class="str">"111"</span><span class="pun">;</span></code></li><li class="L4"><code class="language-javascript"><span class="pln">            </span><span class="pun">}</span><span class="pln">   </span></code></li><li class="L5"><code class="language-javascript"><span class="pln">        </span><span class="pun">});</span></code></li><li class="L6"><code class="language-javascript"></code></li><li class="L7"><code class="language-javascript"><span class="pln">        </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">};</span></code></li><li class="L8"><code class="language-javascript"><span class="pln">        g</span><span class="pun">.</span><span class="pln">each</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it</span><span class="pun">,</span><span class="pln"> idx</span><span class="pun">,</span><span class="pln"> obj</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li class="L9"><code class="language-javascript"><span class="pln">            </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">idx </span><span class="pun">==</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">   </span><span class="com">//idx是键值</span></code></li><li class="L0"><code class="language-javascript"><span class="pln">                obj</span><span class="pun">[</span><span class="pln">idx</span><span class="pun">]=</span><span class="lit">3</span><span class="pun">;</span><span class="pln"> </span><span class="com">//obj就是该对象</span></code></li><li class="L1"><code class="language-javascript"><span class="pln">                </span><span class="kwd">return</span><span class="pun">;</span></code></li><li class="L2"><code class="language-javascript"><span class="pln">            </span><span class="pun">}</span></code></li><li class="L3"><code class="language-javascript"><span class="pln">            </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">it </span><span class="pun">==</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="com">//it是遍历到的值</span></code></li><li class="L4"><code class="language-javascript"><span class="pln">                </span><span class="kwd">return</span><span class="pun">;</span></code></li><li class="L5"><code class="language-javascript"><span class="pln">            </span><span class="pun">}</span></code></li><li class="L6"><code class="language-javascript"><span class="pln">        </span><span class="pun">});</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.each(Array,Function)<br />
                    对数据或者对象进行遍历，返回两个3个参数，一个是该行，一个是位置，一个是对象本身<br />
                </tt>
            </div>
        </div>


        <div id="shuffle" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>shuffle</strong> </span> <span class="title-type">Function(Array)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">          </span><span class="com">//*------将数组随机排序--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                                </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">shuffle</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原数组不变 </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry2</span><span class="pun">);</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.shuffle(Array)//将数组随机乱序<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="shuffleInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div> <input id="shuffleButton" type="button" value="执行  g.shuffle(Array)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) <span class="font-red">（原数组会改变）</span>JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="shuffleOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="shuffleOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#shuffleButton").click(function () {
                        var objAry1 = JSON.parse($('#shuffleInput').val());
                        var objAry2 = g.shuffle(objAry1);
                        //var objAry2 = g.shuffle(objAry1, '*.state==@state', { state:1});
                        $('#shuffleOutput').val(JSON.stringify(objAry1));
                        $('#shuffleOutput1').val(JSON.stringify(objAry2));
                    });
                </script>
            </div>
        </div>

        <div id="intersection" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>intersection</strong> </span> <span class="title-type">Function(Array,Array,String/Function,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">          </span><span class="com">//*------两个数据的交集--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如：  </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"7"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"8"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry3 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">intersection</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">);</span><span class="com">//objAry3是[{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"}] </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//没有第3个参数要是对比行是否一样</span></code></li><li class="L4"><code class="lang-javascript"></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry3 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">intersection</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*0.id==*1.id'</span><span class="pun">);</span><span class="com">//两个数组字段id交集  </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者   </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry3 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">intersection</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">a</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">a</span><span class="pun">.</span><span class="pln">id </span><span class="pun">==</span><span class="pln"> b</span><span class="pun">.</span><span class="pln">id</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="pun">});</span><span class="com">//效率最高  </span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原数组不变  </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry3</span><span class="pun">);</span><span class="pln"> </span><span class="com">//objAry3是'[{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"}]';  </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 objAry1与objAry2 字段id的交集</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.intersection(Array,Array1,String/Function,Object)<br />
                    //求出两个表的交集,出来的数据以Array的行<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="intersectionInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    请输入对象字符串1<b>[Array1]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="intersectionInput1" class="InputTextarea">[{"id":"7","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"8","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="intersectionCanshu1" class="InputTextarea">  function (a, b) { 
                        if (a.id == b.id) 
                        {
                                 return  true; 
                        }
                     }
                </textarea>
                </div>
                <div style="padding:10px;">参数2<b>[Object]</b>：<input id="intersectionCanshu2" type="text" value="" /></div>
                <div> <input id="intersectionButton" type="button" value="执行  g.intersection(Array,Array1,String/Function,Object)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) （原对象不会改变）JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="intersectionOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="intersectionOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#intersectionButton").click(function () {
                        var objAry1 = JSON.parse($('#intersectionInput').val());
                        var objAry2 = JSON.parse($('#intersectionInput1').val());
                        var canshu1 = $('#intersectionCanshu1').val();

                        var canshu2;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#intersectionCanshu2').val() == '') {
                            canshu2 = null;
                        } else {
                            canshu2 = JSON.parse($('#intersectionCanshu2').val());
                        }
                        if (canshu1 == '') {
                            canshu1 = null;
                        }
                        var objAry3 = g.intersection(objAry1, objAry2, canshu1, canshu2);
                        //var objAry3 = g.intersection(objAry1, '*.state==@state', { state:1});
                        $('#intersectionOutput').val(JSON.stringify(objAry1));
                        $('#intersectionOutput1').val(JSON.stringify(objAry3));
                    });
                </script>
            </div>
        </div>

        <div id="subtract" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>subtract</strong> </span> <span class="title-type">Function(Array,Array,String/Function,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">            </span><span class="com">//*------数组的差集--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如：  </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"7"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"8"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry3 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">subtract</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">);</span><span class="com">//objAry3是[{"id":"1","name":"aa","state":"1"},{"id":"4","name":"dd","state":"0"}] </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//没有对比条件时，就是行是否都一样</span></code></li><li class="L4"><code class="lang-javascript"></code></li><li class="L5"><code class="lang-javascript"></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry3 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">subtract</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*0.id==*1.id'</span><span class="pun">);</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者  </span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry3 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">subtract</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">a</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">a</span><span class="pun">.</span><span class="pln">id </span><span class="pun">==</span><span class="pln"> b</span><span class="pun">.</span><span class="pln">id</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//都是 objAry1与objAry2 字段id的差集  </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原数组不变  </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry3</span><span class="pun">);</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry3是'[{"id":"1","name":"aa","state":"1"},{"id":"4","name":"dd","state":"0"}]';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.subtract(Array,Array1,String/Function,Object)<br />
                    //Array-Array1差集<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="subtractInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    请输入对象字符串1<b>[Array1]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="subtractInput1" class="InputTextarea">[{"id":"7","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"8","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="subtractCanshu1" class="InputTextarea">  function (a, b) { 
                        if (a.id == b.id) 
                        {
                                 return  true; 
                        }
                     }</textarea>
                </div>
                <div style="padding:10px;">参数2<b>[Object]</b>：<input id="subtractCanshu2" type="text" value="" /></div>
                <div> <input id="subtractButton" type="button" value="执行  g.subtract(Array,Array1,String/Function,Object)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) （原对象不会改变）JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="subtractOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="subtractOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#subtractButton").click(function () {
                        var objAry1 = JSON.parse($('#subtractInput').val());
                        var objAry2 = JSON.parse($('#subtractInput1').val());
                        var canshu1 = $('#subtractCanshu1').val();
                        var canshu2;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#subtractCanshu2').val() == '') {
                            canshu2 = null;
                        } else {
                            canshu2 = JSON.parse($('#subtractCanshu2').val());
                        }
                        if (canshu1 == '') {
                            canshu1 = null;
                        }
                        var objAry3 = g.subtract(objAry1, objAry2, canshu1, canshu2);
                        //var objAry3 = g.subtract(objAry1, '*.state==@state', { state:1});
                        $('#subtractOutput').val(JSON.stringify(objAry1));
                        $('#subtractOutput1').val(JSON.stringify(objAry3));
                    });
                </script>
            </div>
        </div>

        <div id="union" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>union</strong> </span> <span class="title-type">Function(Array,Array,String/Function,Object)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">           </span><span class="com">//*------数组的并集--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如：  </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"7"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"8"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry3 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="kwd">union</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">);</span><span class="com">//就是所有字段都比较 </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry3是[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"}, </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"3", "name":"cc", "state":"1" },{ "id":"4", "name":"dd", "state":"0" }, </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"7", "name":"aa", "state":"1" },{ "id":"8", "name":"dd", "state":"0" }]</span></code></li><li class="L7"><code class="lang-javascript"></code></li><li class="L8"><code class="lang-javascript"></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry3 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="kwd">union</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="str">'*0.id==*1.id'</span><span class="pun">);</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者  </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry3 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="kwd">union</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">a</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">a</span><span class="pun">.</span><span class="pln">id </span><span class="pun">==</span><span class="pln"> b</span><span class="pun">.</span><span class="pln">id</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln">  </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="pun">});</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//并集与objAry2 字段id的并集  </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原数组不变  </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry3</span><span class="pun">);</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//objAry3是'[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},  </span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"3", "name":"cc", "state":"1" },{ "id":"4", "name":"dd", "state":"0" },  </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//{ "id":"7", "name":"aa", "state":"1" },{ "id":"8", "name":"dd", "state":"0" }]';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.union(Array,Array1,String/Function,Object)<br />
                    //求出两个数组的并集<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="unionInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    请输入对象字符串1<b>[Array1]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="unionInput1" class="InputTextarea">[{"id":"7","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"8","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Function]</b>
                </div>
                <div>
                    <textarea id="unionCanshu1" class="InputTextarea">  function (a, b) { 
                        if (a.id == b.id) 
                        {
                                 return  true; 
                        }
                     }</textarea>
                </div>
                <div style="padding:10px;">参数2<b>[Object]</b>：<input id="unionCanshu2" type="text" value="" /></div>
                <div> <input id="unionButton" type="button" value="执行 g.union(Array,Array1,String/Function,Object)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) （原对象不会改变）JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="unionOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="unionOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#unionButton").click(function () {
                        var objAry1 = JSON.parse($('#unionInput').val());
                        var objAry2 = JSON.parse($('#unionInput1').val());
                        var canshu1 = $('#unionCanshu1').val();
                        var canshu2;
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if ($('#unionCanshu2').val() == '') {
                            canshu2 = null;
                        } else {
                            canshu2 = JSON.parse($('#unionCanshu2').val());
                        }
                        if (canshu1 == '') {
                            canshu1 = null;
                        }
                        var objAry3 = g.union(objAry1, objAry2, canshu1, canshu2);
                        //var objAry3 = g.union(objAry1, '*.state==@state', { state:1});
                        $('#unionOutput').val(JSON.stringify(objAry1));
                        $('#unionOutput1').val(JSON.stringify(objAry3));
                    });
                </script>
            </div>
        </div>

        <div id="isSameCollect" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>isSameCollect</strong> </span> <span class="title-type">Function(Array,Array,String/Array)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                  </span><span class="com">//*------两个数组是不是一样--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"7"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"8"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> bool2 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">isSameCollect</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span><span class="com">//数组中id字段是不是一样的 </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">bool1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//bool1都是'false'; </span></code></li><li class="L5"><code class="lang-javascript"></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> bool1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">isSameCollect</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="str">'name'</span><span class="pun">);</span><span class="com">//数组中name字段是不是一样的 </span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">bool1</span><span class="pun">);</span><span class="pln">  </span><span class="com">//bool1都是'true';      </span></code></li><li class="L9"><code class="lang-javascript"></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> bool1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">isSameCollect</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="str">'name,id'</span><span class="pun">);</span><span class="com">//数组中name,id字段是不是一样的 </span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> bool1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">isSameCollect</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[</span><span class="str">"name"</span><span class="pun">,</span><span class="str">"id"</span><span class="pun">]);</span><span class="com">//数组中name,id字段是不是一样的 </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">bool1</span><span class="pun">);</span><span class="pln">  </span><span class="com">//bool1都是'false';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.isSameCollect(Array,Array1,String/Array)<br />
                    //两个数组是不是一样的（可以根据某些字段判断）<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="isSameCollectInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    请输入对象字符串1<b>[Array1]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="isSameCollectInput1" class="InputTextarea">[{"id":"7","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"8","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Array]</b>
                </div>
                <div>
                    <textarea id="isSameCollectCanshu1" class="InputTextarea">id</textarea>
                </div>
                <div> <input id="isSameCollectButton" type="button" value="执行  g.isSameCollect(Array,Array1,String/Array)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) （原对象不会改变）JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="isSameCollectOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="isSameCollectOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#isSameCollectButton").click(function () {
                        var objAry1 = JSON.parse($('#isSameCollectInput').val());
                        var objAry2 = JSON.parse($('#isSameCollectInput1').val());
                        var canshu1 = $('#isSameCollectCanshu1').val();
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if (canshu1 == '') {
                            canshu1 = null;
                        }
                        var objAry3 = g.isSameCollect(objAry1, objAry2, canshu1);
                        //var objAry3 = g.isSameCollect(objAry1, '*.state==@state', { state:1});
                        $('#isSameCollectOutput').val(JSON.stringify(objAry1));
                        $('#isSameCollectOutput1').val(JSON.stringify(objAry3));
                    });
                </script>
            </div>
        </div>

        <div id="isPartSet" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>isPartSet</strong> </span> <span class="title-type">Function(Array,Array,String/Array)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                     </span><span class="com">//*------数组是不是一部分（数组1是不是包含数组2）--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry3 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> bool1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">isPartSet</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">bool1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//bool1都是'false'; </span></code></li><li class="L6"><code class="lang-javascript"></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> bool1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">isPartSet</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry3</span><span class="pun">,</span><span class="pln"> </span><span class="str">'name'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">bool1</span><span class="pun">);</span><span class="com">//bool1都是'true';       </span></code></li><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> bool1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">isPartSet</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry3</span><span class="pun">,</span><span class="pln"> </span><span class="str">'name,id'</span><span class="pun">);</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> bool1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">isPartSet</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry3</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[</span><span class="str">"name"</span><span class="pun">,</span><span class="str">"id"</span><span class="pun">]);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">bool1</span><span class="pun">);</span><span class="com">//bool1都是'false';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.isPartSet(Array,Array1,String/Array)<br />
                    //Array1是不是是Array的一部分<br />
                    //Array是否包含Array1<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="isPartSetInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    请输入对象字符串1[Array11]（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="isPartSetInput1" class="InputTextarea">[{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"3","name":"cc","state":"1"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Array]</b>
                </div>
                <div>
                    <textarea id="isPartSetCanshu1" class="InputTextarea">id</textarea>
                </div>
                <div> <input id="isPartSetButton" type="button" value="执行 g.isPartSet(Array,Array1,String/Array)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) （原对象不会改变）JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="isPartSetOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="isPartSetOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#isPartSetButton").click(function () {
                        var objAry1 = JSON.parse($('#isPartSetInput').val());
                        var objAry2 = JSON.parse($('#isPartSetInput1').val());
                        var canshu1 = $('#isPartSetCanshu1').val();
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if (canshu1 == '') {
                            canshu1 = null;
                        }
                        var objAry3 = g.isPartSet(objAry1, objAry2, canshu1);
                        //var objAry3 = g.isPartSet(objAry1, '*.state==@state', { state:1});
                        $('#isPartSetOutput').val(JSON.stringify(objAry1));
                        $('#isPartSetOutput1').val(JSON.stringify(objAry3));
                    });
                </script>
            </div>
        </div>

        <div id="isSubset" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>isSubset</strong> </span> <span class="title-type">Function(Array,Array,String/Array)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                     </span><span class="com">//*------数组2是不是数组1的子集--------*/       </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//例如： </span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"aa"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L6"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                        </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"4"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"dd"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry2 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                    </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> objAry3 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"bb"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0"</span><span class="pln"> </span><span class="pun">},</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">            </span><span class="pun">{</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"3"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"cc"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"state"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">}];</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> bool1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">isSubset</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id'</span><span class="pun">);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原数组不变 </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">bool1</span><span class="pun">);</span><span class="com">//bool1都是'true'; </span></code></li><li class="L6"><code class="lang-javascript"></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> bool1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">isSubset</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry3</span><span class="pun">,</span><span class="pln"> </span><span class="str">'name'</span><span class="pun">);</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原数组不变 </span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">bool1</span><span class="pun">);</span><span class="pln"> </span><span class="com">//bool1都是'true';</span></code></li><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> bool1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">isSubset</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="str">'id,name'</span><span class="pun">);</span></code></li><li class="L2"><code class="lang-javascript"><span class="pln">                 </span><span class="com">//或者 </span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> bool1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">isSubset</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">,</span><span class="pln"> objAry2</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[</span><span class="str">"id"</span><span class="pun">,</span><span class="str">"name"</span><span class="pun">]);</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">objAry1</span><span class="pun">);</span><span class="com">//原数组不变 </span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">bool1</span><span class="pun">);</span><span class="com">//bool1都是'true';</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.isSubset(Array,Array1,String/Array)<br />
                    //Array1是不是是Array的子集<br />

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入对象字符串<b>[Array]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="isSubsetInput" class="InputTextarea">[{"id":"1","name":"aa","state":"1"},{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"4","name":"dd","state":"0"}]</textarea>
                </div>
                <div>
                    请输入对象字符串1<b>[Array1]</b>（对象中用JSON.parse(String)）
                </div>
                <div>
                    <textarea id="isSubsetInput1" class="InputTextarea">[{"id":"2","name":"bb","state":"0"},{"id":"3","name":"cc","state":"1"},{"id":"3","name":"cc","state":"1"}]</textarea>
                </div>
                <div>
                    参数1<b>[String/Array]</b>
                </div>
                <div>
                    <textarea id="isSubsetCanshu1" class="InputTextarea">id</textarea>
                </div>
                <div> <input id="isSubsetButton" type="button" value="执行 g.isSubset(Array,Array1,String/Array)" /> </div>
                <div>
                    显示结果(<b>原数组</b>) （原对象不会改变）JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="isSubsetOutput" class="OutputTextarea"></textarea>
                </div>
                <div>
                    显示结果（<b>返回的数组/对象</b>） JSON.stringify(Object);
                </div>
                <div>
                    <textarea id="isSubsetOutput1" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#isSubsetButton").click(function () {
                        var objAry1 = JSON.parse($('#isSubsetInput').val());
                        var objAry2 = JSON.parse($('#isSubsetInput1').val());
                        var canshu1 = $('#isSubsetCanshu1').val();
                        if (g.like(canshu1, '%function%')) {
                            eval('canshu1 = ' + canshu1);
                        }
                        if (canshu1 == '') {
                            canshu1 = null;
                        }
                        var objAry3 = g.isSubset(objAry1, objAry2, canshu1);
                        //var objAry3 = g.isSubset(objAry1, '*.state==@state', { state:1});
                        $('#isSubsetOutput').val(JSON.stringify(objAry1));
                        $('#isSubsetOutput1').val(JSON.stringify(objAry3));
                    });
                </script>
            </div>
        </div>






    </div>

</body>
</html>